import { createApp } from "vue";
import App from "./App";
import { setupStore } from "@/stores";
import { setupRouter } from "@/router";
import setupAssets from "@utils/common/Assets";

async function setupApp() {
  // import 样式文件等
  setupAssets();
  const app = createApp(App);

  // 使用pinia 状态管理
  setupStore(app);

  // 使用路由
  await setupRouter(app);

  // 设置 naive-ui 样式挂载的位置 以防被其他样式覆盖
  const meta = document.createElement("meta");
  meta.name = "naive-ui-style";
  document.head.appendChild(meta);

  // 挂载根节点
  app.mount("#app");
}

await setupApp();
